<template>
  <div class="index">
    <a-header :title='title'></a-header>
    <div class="container has-header">
      <div class="banner-con" style="height:1.2rem;background:#f90">
          <d-banner></d-banner>
      </div>
      <div class="list-container">
            <div class="card-box" @click='goDetail(id,jcData.pid)'>
                <div class="card-timerow">
                    <div class="card-timebox">
                        <p class="card-num">第{{jcData.pid}}期</p> 
                        <p class="card-week">{{jcData.atime.substring(0,10)}}</p>
                    </div> 
                </div> 
                <div :class="'80,81,82,83'.indexOf(id)>-1?'card-vic':'card-ball'">
                    <template v-if='jcData.code.indexOf("|")>-1'>
                        <em v-for='num1 in jcData.code.split("|")[0].split(",")'>{{num1}}</em>
                        <em class="blue-ball" v-for='num2 in jcData.code.split("|")[1].split(",")'>{{num2}}</em>
                    </template>
                    <template v-else >
                        <em v-for='num3 in jcData.code.split(",")'>{{num3}}</em>
                    </template>
                </div> 
                <div v-if='jcData.ninfo'>
                    <div class="card-money card-moneyonly">
                        <div class="card-monbox">
                            <p class="card-nums">
                                <b>一等奖:</b> 
                                <span>{{jcData.ninfo.split(',')[0]}}</span><em>注</em>
                            </p>
                        </div> 
                        <div class="card-monbox">
                            <p class="card-nums"><b>奖池:</b><span>{{jcData.gpool}}</span></p>
                        </div>
                    </div>
                </div>
            </div>
            <template v-for='(item,index) in dataList'>
                <div class="card-box" v-if='index > 0'  @click='goDetail(id,item.pid)'>
                    <div class="card-linetime">
                        <p class="card-num" v-if='item.pid'>第{{item.pid}}期</p> 
                        <p class="card-week" v-if='item.et'>{{ item.et.substring(0,10) }}</p>
                    </div> 
                    <div class="card-3dbox">
                        <div class="card-3dnum">
                            <template v-if='item.opencode.indexOf("|")>-1'>
                                <em v-for='num1 in item.opencode.split("|")[0].split(",")'>{{num1}}</em>
                                <em class="blue-ball" v-for='num2 in item.opencode.split("|")[1].split(",")'>{{num2}}</em>
                            </template>
                            <template v-else >
                                <em v-for='num3 in item.opencode.split(",")'>{{num3}}</em>
                            </template>
                        </div>
                        <div class="card-mricon"></div>
                    </div>
                </div>
            </template>
            

      </div>
    </div>
  </div>
</template>
<script>
import aHeader from '@/components/header'
import {get} from '@/request/http'
import dBanner from "@/components/banner"
export default {
  name: 'index',
  components: {
    aHeader,
    dBanner
  },
  data(){
    return {
        title:'',
        id:'',
        dataList:[],
        jcData:{}
    }
  },
  methods:{
    hanldNav(idx){
        this.navCurren = idx;
        if (idx==1&&currentData == '') {
            getOtherData()
        }
        if (idx==2&&higtData == '') {
            getHigtData()
        }
    },
    getJC(id,pid){
        get('/cpdata/guoguan/'+id+'/'+pid+'/'+pid+'.json?_='+Math.random())
        .then(v=>{
            this.jcData = v.rows; 
         })
    },
    getList(id){
        get('/tdata/'+id+'/last_100.json')
        .then(v=>{
            let data = v.period.row;
            this.dataList = data
            this.getJC(id,data[0].pid);
        })
    },
    goDetail(id,pid){
        this.$router.push('/detail/index/'+id+'/'+pid)
    }
  },
  created(){
    const id = this.$route.params.id;
    const name = this.lotteryId[id][0];
    this.title = name;
    this.id= id;
    this.getList(id);
    console.log(this.dataList)
  }
};

</script>
<style lang="less" scoped>
  @import '../assets/style/record.less';
</style>
